	function addInputErrorMessage(item,message){
		try{
			clearInputState(item);
			var span = document.createElement("SPAN");
			span.id = "__ErrorMessagePanel";
			span.style.color = "red";
			item.parentNode.appendChild(span);
			span.innerHTML = "<br />" + message.replace(/\d+:/,"");
		}
		catch(e){alert(e.description);}
		// item.focus();
	}
	
	function clearAllInputItem() {
		var items = document.getElementsByTagName("input");
		for (var i = 0; i < items.length; i++) {
			if (items[i].type == "text" || items[i].type == "password") {
				clearInputState(items[i]);
			}
		}
	}    
	function clearInputState(elem){
		with(elem){
			if(style.color == "red")
				style.color = "";
			var lastNode = parentNode.childNodes[parentNode.childNodes.length-1];
			if(lastNode.id == "__ErrorMessagePanel")
				parentNode.removeChild(lastNode);
		}
	}

	String.prototype.trim = function() {
		return this.replace(/^\s+|\s+$/g,"");
	}
	
	String.prototype.len = function(){
		return this.replace(/[^\x00-\xff ]/g, "aa").length;
	}